package com.jhws.business.local.api;

import com.jhws.business.face.bo.FaceInfo;
import com.jhws.business.face.service.FaceService;
import com.jhws.business.local.service.LocalService;
import com.jhws.common.base.bo.JsonRespData;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@Controller
@RequestMapping("/face")
public class FaceApi {
    @Resource
    private LocalService localService;
    @Resource
    private FaceService faceService;

    @RequestMapping("uploadLocalFace")
    @ResponseBody
    public JsonRespData uploadVideoAds(@RequestParam("image") MultipartFile image,
                                       @RequestParam("face") MultipartFile face,
                                       FaceInfo faceInfo) throws Exception {
        faceInfo = localService.saveFaceImage(image, face, faceInfo);
        faceService.saveFaceInfo(faceInfo);
        return new JsonRespData("", 1, "上传成功");
    }
}
